#ifndef _EVENT_LIST_H_
#define _EVENT_LIST_H_

#include "job.hpp"

#include <queue>
#include <vector>
#include <iostream>

class Queue;

enum event_t {MOVE, END};

class Event_Notice {
 public:
  Event_Notice(event_t t, double rt, double ot, Job *job, Queue *source = NULL, Queue *dest = NULL);
  bool operator<(const Event_Notice &e) const;
  double get_occ_time();
  Job *get_job();
  Queue *get_source();
  Queue *get_dest();
  event_t get_event_type();
  friend std::ostream &operator<<(std::ostream &os, const Event_Notice &q);

 private:
  event_t event_type;
  double reg_time; //registration time
  double occ_time; //occurrence time
  Job *job;
  Queue *source, *dest; //source/dest of the MOVE
};

class Event_Notice_Compare {
 public:
  bool operator()(const Event_Notice *e1, const Event_Notice *e2);
};



class Event_List {
 public:
  Event_Notice *fetch();
  void schedule(Event_Notice *e);
  unsigned long size();
  friend std::ostream &operator<<(std::ostream &os, const Event_List &q);

 private:
  std::priority_queue<Event_Notice *, std::vector<Event_Notice *>, Event_Notice_Compare> event_list;
};
#endif
